--[[ 编码: WMS-56-25 名称: 组盘明细-组盘输入-强制任务完成 作者:HAN 日期:2025-1-29 级别:固定 (说明本段代码在项目中不太会变化) 函数:SetTaskFinish 功能: -- 当前入库任务任务数量没到计划入库数量,点强制完成 -- 如果当前出到站台的料箱的入库任务全部完成即可创建 【货品入库】作业 更改记录: -- V2.0 KUN 20250211 强制完成时入库数量不能大于计划入库数量 --]] wms_wh = require( "wms_wh" ) wms_cntr = require( "wms_container" ) prj_base = require( "prj_base" ) function SetTaskFinish ( strLuaDEID ) local nRet, strRetInfo local runtime_parameter nRet, runtime_parameter = m3.GetRuntimeParam(strLuaDEID) if ( nRet ~= 0 ) then lua.Error( strLuaDEID, debug.getinfo(1), "GetRuntimeParam失败! "..runtime_parameter ) end -- 获取【组盘输入】面板的参数 local parameter nRet, parameter = m3.GetRuntimePanel_InputParamter( strLuaDEID, runtime_parameter.panel, "组盘输入" ) if ( nRet == 1 ) then mobox.setInfo( strLuaDEID, "没有定义'组盘输入'面板参数!") return end if ( nRet ~= 0 ) then lua.Error( strLuaDEID, debug.getinfo(1), parameter ) end if ( parameter == nil ) then return end local id = parameter.id -- 当前点中的入库任务标识 local pac_no = parameter.pac_no -- 当前点中的入库任务所属组盘号 if ( pac_no == nil or pac_no == "") then mobox.setInfo( strLuaDEID, "'组盘输入'面板必须有orgc_no参数!") return end -- 获取当前计划入库任务装箱数量 nRet, strRetInfo = mobox.getCurEditDataObjAttr( strLuaDEID, "F_QTY", "F_ACT_QTY" ) if ( nRet ~= 0 ) then lua.Error( strLuaDEID, debug.getinfo(1), "获取当前编辑属性失败! "..strRetInfo ) end local obj_attrs = json.decode( strRetInfo ) local qty = lua.Get_NumAttrValue( obj_attrs[1].value ) local act_qty = lua.Get_NumAttrValue( obj_attrs[2].value ) local cancel_qty = qty-act_qty if ( qty == 0 ) then return end -- V2.0 if ( act_qty > qty ) then mobox.setInfo( strLuaDEID, "入库数量不能大于计划数量!") return end -- 设置【组盘明细】状态 = 2(组盘完成) local strCondition = "S_ID = '"..id.."'" local strUpdateSql = "N_B_STATE = 2, F_ACT_QTY = "..act_qty..", F_CANCEL_QTY = "..cancel_qty nRet, strRetInfo = mobox.updateDataAttrByCondition( strLuaDEID, "Pre_Alloc_CNTR_Detail", strCondition, strUpdateSql ) if ( nRet ~= 0 ) then lua.Error( strLuaDEID, debug.getinfo(1), "更新【组盘明细】信息失败!"..strRetInfo ) end local action nRet, action = prj_base.Pre_Alloc_CNTR_PostProcess( strLuaDEID, pac_no, parameter.station, parameter.cntr_code ) if ( nRet ~= 0 ) then lua.Stop( strLuaDEID, "Pre_Alloc_CNTR_PostProcess 失败!"..action ) return end nRet, strRetInfo = mobox.setAction( strLuaDEID, lua.table2str(action) ) if ( nRet ~= 0 ) then lua.Error( strLuaDEID, debug.getinfo(1), "setAction失败! "..strRetInfo..' action = '..strAction ) end end